<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Render Comp</title>
        <script src="../dist/vue-2.6.14.js"></script>
    </head>
    <body>
        <div id="app">
            <example :ok="ok"></example>
            <button @click="ok = !ok">toggle</button>
        </div>

        <script>
            const Foo = {
                render: (h) => h('div', 'foo'),
            };

            const Bar = {
                render: (h) => h('div', 'bar'),
            };

            Vue.component('example', {
                props: ['ok'],
                render(h) {
                    if (this.ok) {
                        return h(Foo);
                    }
                    return h(Bar);
                },
            });

            new Vue({
                el: '#app',
                data() {
                    return { ok: true };
                },
            });
        </script>
    </body>
</html>
